package com.dididoctor.doctor.Dialog;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.TextView;

import com.dididoctor.doctor.Dialog.adapter.BaseDialog;
import com.dididoctor.doctor.R;


public class ComplaintPhoneDialog extends BaseDialog {
    private TextView mTvConfirm, mTvCancel;
    private Context context;
    private String phoneNumber;

    public ComplaintPhoneDialog(Context context,String phoneNumber) {
        super(context);
        this.context = context;
        this.phoneNumber = phoneNumber;
        setContentView(R.layout.dialog_complainphone);
        mTvConfirm = (TextView) findViewById(R.id.tv_confirm);
        mTvConfirm.setOnClickListener(this);
        mTvCancel = (TextView) findViewById(R.id.tv_cancel);
        mTvCancel.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_confirm:
                Intent phoneIntent = new Intent("android.intent.action.CALL",
                        Uri.parse("tel:"+phoneNumber));
                // 启动
                context.startActivity(phoneIntent);
                dismiss();
                break;
            case R.id.tv_cancel:
                dismiss();
                break;
            default:
                break;
        }
        super.onClick(v);
    }

}
